//
//  JKRTopicVoiceView.m
//  百思不得姐
//
//  Created by Lucky on 16/3/11.
//  Copyright © 2016年 Lucky. All rights reserved.
//

#import "JKRTopicVoiceView.h"
#import "JKRTopic.h"

@interface JKRTopicVoiceView ()

@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@property (weak, nonatomic) IBOutlet UILabel *voiceLengthLabel;

@property (weak, nonatomic) IBOutlet UILabel *playCountLabel;


@end

@implementation JKRTopicVoiceView

+ (instancetype)voiceView
{
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
}

- (void)awakeFromNib
{
    self.autoresizingMask = UIViewAutoresizingNone;
}

- (void)setTopic:(JKRTopic *)topic
{
    _topic = topic;
    
    [self.imageView sd_setImageWithURL:[NSURL URLWithString:topic.large_image]];
    self.playCountLabel.text = [NSString stringWithFormat:@"%zd播放", topic.playcount];
    
    NSInteger minute = topic.voicetime / 60;
    NSInteger second = topic.voicetime % 60;
    
    self.voiceLengthLabel.text = [NSString stringWithFormat:@"%02zd:%02zd", minute, second];
}

@end
